﻿
function MM_displayStatusMsg(msgStr) { //v1.0
    status = msgStr;
    document.MM_returnValue = true;
}

$(document).ready(function () {
    $(document).bind("contextmenu", function () { return false; });
});

$(window).load(function () {
    if ($(".ImgComic").width() > screen.width)
        $(".ImgComic").width(screen.width - 30)
    $(".ImgComic").after(nextPhoto);
});

function lastPageConfirm() {
    if (confirm('已经是最后一页了，是否返回目录？'))
        location.href = '../';
}

var __is_ff = (navigator.userAgent.indexOf("Firefox") != -1); // Firefox
function getEvent() {
    if (document.all)
        return window.event;
    func = getEvent.caller;
    while (func != null) {
        var arg0 = func.arguments[0];
        if (arg0) {
            if ((arg0.constructor == Event || arg0.constructor == MouseEvent)
					|| (typeof (arg0) == "object" && arg0.preventDefault && arg0.stopPropagation)) {
                return arg0;
            }
        }
        func = func.caller;
    }
    return null;
}
function getMouseLocation() {
    e = getEvent();
    var mouseX = 0;
    if (__is_ff) {
        mouseX = e.layerX + document.body.scrollLeft;
    } else {
        mouseX = e.offsetX + document.body.scrollLeft;
    }
    return mouseX;
}
function click_pic(o) {
    var offset_x = getMouseLocation();
    if (offset_x <= o.clientWidth / 2) {
        previousPage = (previousPage == '#T') ? "/" : previousPage;
        window.location.href = "?page=" + previousPage;
    } else {
        if (page < maxPage) {
            nextPage = (nextPage == '#T') ? "/" : nextPage;
            window.location.href = "?page=" + nextPage;
        } else {
            lastPageConfirm();
        }
    }
}
function change_style(o) {
    var offset_x = getMouseLocation();
    if (offset_x <= o.clientWidth / 2) {
        if (!o.style.cursor.match("pre")) {
            o.style.cursor = 'url("/images/pre.cur"), pointer'; // "NW-resize";
        }
    } else if (!o.style.cursor.match("next")) {
        o.style.cursor = 'url("/images/next.cur"), pointer';
    }
    return;
}